import os
import sys

# 添加项目根目录到 Python 路径
sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from app import create_app
from app.extensions import db
from app.models import User, ProfileInfo, CarouselImage

app = create_app()

@app.shell_context_processor
def make_shell_context():
    """为Flask shell添加上下文"""
    return {
        'db': db,
        'User': User,
        'ProfileInfo': ProfileInfo,
        'CarouselImage': CarouselImage
    }

if __name__ == '__main__':
    # 将 host 参数设置为 '0.0.0.0'
    app.run(debug=True, host='127.0.0.1')